#pragma once

#include <memory>
#include "Containers/Vector.h"

class CStatementContext;
class CFunctionContext;
struct SDecoratedTypeDescription;
class CTypeDescription;

class CExpressionContext :public std::enable_shared_from_this<CExpressionContext>
{

public:

    CExpressionContext(
        std::weak_ptr<CStatementContext> InParentSentence,
        std::weak_ptr<CExpressionContext> InParentExpression //can bu null
    );
    
    std::shared_ptr<CStatementContext> GetSentence();

    std::shared_ptr<CFunctionContext> GetFunction();

    std::shared_ptr<CTypeDescription> GetOwnerClass();

    std::shared_ptr<CExpressionContext> NewSubExpression();

    //the expected type of the expression
    //expression will be converted to one of the expected types
    //if ExpectedTypes is empty , no type check will be performed
    TVector<SDecoratedTypeDescription> ExpectedTypes;

    //decalaration of delegate will expect a variable with function type
    //and set ExpectedFunctionType
    //and LoadFunction will consume it(set ExpectedFunctionType to nullptr)
    //SDecoratedTypeDescription ExpectedFunctionType;

protected:
    std::weak_ptr<CStatementContext> ParentSentence;
    std::weak_ptr<CExpressionContext> ParentExpression;

};